<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
@version 1.0: mod_S5MapIt
Author: Shape 5 - Professional Template Community
Free extension available for download at www.shape5.com
*/


// no direct access

$text  = $params->get( 'text');
$sub1  = $params->get( 'zipp');
$naar =  $params->get( 'addresss');
$cols  = $params->get( 'cityy');
$rows  = $params->get( 'statee');

if ($text != "") {
echo $text;
?>
<div style="height:9px"></div>
<?php 
}
  
?>

<!-- Form -->

<div style="width:80%;">
<form name="form1" action="">

<div>Direccion:
<input style="width:100%" class="inputbox" type="text" name="saddr" /></div>

<div>Ciudad:
<input style="width:100%" class="inputbox" type="text" name="saddr2" /></div>

<div>Provincia:
<input style="width:100%" class="inputbox" type="text" name="saddr22" /></div>

<div>Pais:
<input style="width:100%" class="inputbox" type="text" name="saddr222" /></div>
<div style="margin-top:5px; margin-bottom:5px">
<input class="button" type="submit" value="Submit" name="checkit" onclick="javascript:GetDirections();return false;"/>
</div>
</form>
<script type="text/javascript">			
//<![CDATA[
		function GetDirections()
		{				
			var SourceAdress = 'saddr=';
			var DestinationAddress = 'daddr=' + '<?php echo $naar; ?>' + ', ' + '<?php echo $cols; ?>' + ', ' + '<?php echo $rows; ?>' + ' ' + '<?php echo $sub1; ?>'; //destination address pulled from admin
			var Url = '';

			//read out source adress from the input field
			SourceAdress += document.form1.saddr.value + ',' + document.form1.saddr2.value + ',' + document.form1.saddr22.value + ',' + document.form1.saddr222.value;	
			//form the url 
			Url = "http://maps.google.com/maps?" + SourceAdress + "&" + DestinationAddress; // + ',output,html';	
			
				//you can use the line below to show the directions in a popup window, don;t forget to comment out the line above... 
			window.open(Url,'directions','width=1024,height=768,scrollbars=yes,toolbar=no,location=no, resizable=no'); 			
		}
//]]>
	</script>
</div>


